<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 引用js封装好的动画函数 -->
    <script src="16-animate.js"></script>
    <style>
        * {
            padding: 0;
            margin: 0;
        }

        .cliderbar {
            position: relative;
            margin-top: 400px;
            width: 50px;
            height: 35px;
            background-color: purple;
            text-align: center;
            line-height: 35px;

        }

        span {
            position: absolute;
            right: 0px;
            width: 50px;
            height: 35px;
            z-index: 999;
            background-color: purple;
            color: #fff;
        }

        .con {
            position: absolute;
            right: 0px;
            bottom: 0;
            width: 120px;
            height: 35px;
            background-color: purple;
            color: #fff;

        }
    </style>
</head>

<body>
    <div class="cliderbar">
        <span>→</span>
        <div class="con">问题反馈</div>
    </div>
    <script>
        var cliderbar = document.querySelector('.cliderbar')
        var con = document.querySelector('.con')
        var span = document.querySelector('span')
        cliderbar.addEventListener('mouseenter', function () {
            // 调用js封装好的动画函数 传递参数即可 （目标对象,目标位置,回调函数）
            // 回调函数参数有需求就写没有就不写,都可以 封装好的函数里有判断是否执行。
            animate(con, 50, function () {
                span.innerHTML = '←'
            })
        })
        cliderbar.addEventListener('mouseleave', function () {
            animate(con, -50, function () {
                span.innerHTML = '→'
            })

        })



    </script>
</body>

</html>